<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 17-1-17
 * Time: 下午5:41
 */


//NULL
//被赋值为 NULL。
//尚未被赋值。
//被 unset()。
$var = null ;
echo $var.PHP_EOL;

$arr = [];
var_dump($arr);

echo ($var == $arr).PHP_EOL; //1
echo ($var === $arr).PHP_EOL; //0
echo is_null($var).PHP_EOL;//1
echo is_null($arr).PHP_EOL;//0

echo gettype($var).PHP_EOL;
echo gettype($arr).PHP_EOL;

$a = [];
echo( ($a != NULL) && ((bool)$a == NULL) ); //0


$test['_string'] = "";
$test['_int'] = 0;
$test['_float'] = 0.0;
$test['_null'] = null;
$test['_arr'] = array();
$test['_obj'] = new \stdClass();

foreach($test as $key => $value)
{
    echo $key.": ";
    if($value == null)
        echo "== is null\n";
    if($value === null){
        echo "=== is null\n";
    }else
        echo "is not null\n";
}